package me.project.common.exception;

import cn.soboys.restapispringbootstarter.i18n.I18NKey;

/**
 * @author 公众号 程序员三时
 * @version 1.0
 * @date 2023/6/26 11:01
 * @webSite https://github.com/coder-amiao
 */
public enum HttpStatus implements ResultCode, I18NKey {
    /**
     * 系统内部错误
     */
    INTERNAL_SERVER_ERROR("500", "internal_server_error"),
    BAD_GATEWAY("502", "bad_gateway"),
    NOT_FOUND("404", "not_found"),
    UNAUTHORIZED("401", "unauthorized"),
    FORBIDDEN("403", "forbidden"),
    METHOD_NOT_ALLOWED("405", "method_not_allowed"),
    REQUEST_TIMEOUT("408", "request_timeout"),
    THE_SERVICE_IS_CIRCUIT_BREAKER("508", "The service is circuit breaker"),

    INVALID_ARGUMENT("10000", "invalid_argument"),
    CARRY_OUT("10004", "操作成功！"),
    THE_INTERFACE_ACCESS_EXCEEDS_THE_FREQUENCY_LIMIT("10005", "接口访问超过频率限制!"),
    INVALID_Android("10082", "appName or packageName already exists!"),
    DUPLICATE_SUBMISSIONS("10083", "打包完成！请不要重复提交！"),
    ARGUMENT_ANALYZE("10001", "argument_analyze"),
    CONTACT_YOUR_ADMINISTRATOR("10002", "请联系管理员!"),
    BUSINESS_EXCEPTION("20000", "business_exception"),
    SEND_FAIL("2001", "Send Email Fail"),
    CONFLICT("2002", "The package name or app name conflicts"),
    THE_DUPLICATE_COMMIT_PREFIX_CANNOT_BE_EMPTY("20001", "重复的提交前缀不能为空!");


    private final String value;

    private final String message;

    HttpStatus(String value, String message) {
        this.value = value;
        this.message = message;
    }


    @Override
    public String getCode() {
        return value;
    }

    @Override
    public String getMessage() {
        return message;
    }


    @Override
    public String key() {
        return message;
    }
}